<?

REQUIRE ($tmppath."include/login.php");
REQUIRE ($tmppath."$templates/up.php");

REQUIRE ($tmppath."protect/connect.php");

$query="SELECT perso_name,perso_classe, perso_race, perso_pic, perso_niv,perso_description, perso_royaume, perso_exp,perso_history,perso_alliance FROM sduser_perso where perso_id=$perso_id";
//0=nom 1 = classe 2=race 3=image 4=niv 5=description 6=royaume 7=pex




$resultat=mysql_query($query);
$perso =mysql_fetch_array($resultat);

$nom=$perso[0];
$classe=$perso[1];
$race=$perso[2];
$image=$perso[3];
$niv=$perso[4];
$description=$perso[5];
$royaume=$perso[6];
$exp=$perso[7];
$historique=$perso[8];
$alliance=$perso[9];

$news_txt=htmlentities($description);
$news_txt=nl2br($description);
$news_txt=htmlentities($historique);
$news_txt=nl2br($historique);


$query ="SELECT classe_name FROM uclasse WHERE classe_id=$classe";
$resultat=mysql_query($query);
$row = mysql_fetch_array($resultat);
$classe=$row[0];

$query ="SELECT race_name FROM urace WHERE race_id=$race";
$resultat=mysql_query($query);
$row = mysql_fetch_array($resultat);
$race=$row[0];



$description=nl2br($description);
$historique=nl2br($historique);



?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle" bordercolor="#000000"><img src="templates/default/ligne.png" width="390" height="35">
      <br>
      <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
        <tr> 
          <td width="38%"><div align="center"><? if ($image!="" ){echo "<img src=\" $image \"  >";}  ?> </div></td>
          <td width="62%"><div align="justify">
              <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                <tr valign="middle"> 
                  <td width="48%"> <div align="right"><font color="#FFFF00"><strong>Nom
                      :</strong></font></div></td>
                  <td width="52%"> <p><? echo "$nom" ?> </p></td>
                </tr>
                <tr valign="middle"> 
                  <td> <div align="right"><font color="#FFFF00"><strong>Royaume
                      :</strong></font></div></td>
                  <td> <p><? echo $royaume ?></p></td>
                </tr>
                <tr valign="middle"> 
                  <td> <div align="right"><font color="#FFFF00"><strong>Race :</strong></font></div></td>
                  <td> <p><? echo $race ?></p></td>
                </tr>
                <tr valign="middle"> 
                  <td> <div align="right"><font color="#FFFF00"><strong>Classe
                      : </strong></font></div></td>
                  <td> <p><? echo $classe ?></p></td>
                </tr>
                <tr valign="middle"> 
                  <td> <p align="right"><font color="#FFFF00"><strong>Niveau
                      :</strong></font></p></td>
                  <td><? echo $niv ?></td>
				    </tr>  <tr>
<?
//Pour afficher les exp seulement si 
IF ($userperso==$perso_id){
  echo"<td><p align=\"right\"><font color=\"#FFFF00\"><strong>Point EXP :</strong></font></p></td>
 <td>$exp</td>";
				  			  
}
//Pou l'alliance.		  
IF (!empty($alliance)){
   $query="SELECT alliance_name FROM sdalliance where alliance_id=$alliance";
   $resultat=mysql_query($query);
   $tmp=mysql_fetch_array($resultat);
 
 			  echo"<td><p align=\"right\"><font color=\"#FFFF00\"><strong>Alliance :</strong></font></p></td>
                  <td>$tmp[0]</td>";
				  
				  
				  }
				  ?>
				  
                </tr>


                </tr>
              </table>
              
            </div></td>
        </tr>
      </table> 
      <img src="templates/default/ligne.png" width="390" height="35"><br>
      <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
        <tr> 
          <td> <p align="center"><strong><u><font color="#FFFF00">Description :</font></u></strong></p>
            <p align="left"><? echo $description; ?></p>
            </td>
        </tr>
      </table>
	    <img src="templates/default/ligne.png" width="390" height="35"><br>
      <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
        <tr> 
          <td> <p align="center"><strong><u><font color="#FFFF00">Historique :</font></u></strong></p>
            <p align="left"><? echo $historique; ?></p>
            </td>
        </tr>
      </table>
      <img src="templates/default/ligne.png" width="390" height="35"> <br>


      </td>
  </tr>
</table>


<?

$query="SELECT count(*) FROM sdconns where conn_joueur=$userperso AND conn_seigneur=$perso_id";
$resultat=mysql_query($query);
$tmp=mysql_fetch_array($resultat);
$con_perso=$tmp[0];

IF ($con_perso==0 && $con_perso!=$userperso){

$perso_tmp="J$perso_id";
$bperso=substr_count($con_perso,$perso_tmp);


SWITCH ($bperso){
       CASE '0':
          echo"<a href=\"include_l.php?p=vis_test&user=$perso_id&perso=$userperso&$SID\">Ajouter $nom dans sa liste de connaissance</a> ";

          


}


}//Fin du if.

?>
</body>
</html>
